#ifndef _LIGHT_H_
#define _LIGHT_H_

#ifdef _WIN32
#pragma once
#endif

/**
 * A class to create, edit and set lights.
 *
 * 24/02/2012 - Stephen Gore - Created the class structure, implemented from 
 *                             UML with all the get and set functions for all 
 *                             all the attributes of the D3DLIGHT9 structure.
 *
 * 25/02/2012 - Stephen Gore - Defined all original functions. 
 *                           - Commented all functions.
 *                           - Made all functions and parameters that need to 
 *                             be are constant
 */

#include <d3dx9.h>

class CLight 
{
public:
    // Constructor.
    CLight();
    CLight(const D3DLIGHT9 &light);

    // Type.
    void setType(D3DLIGHTTYPE type);
    D3DLIGHTTYPE getType();
    
    // Position.
    void setPosition(float x, float y, float z);
    void setPosition(const D3DVECTOR &position);
    void getPosition(float &x, float &y, float &z) const;
    D3DVECTOR getPosition() const;

    // Direction.
    void setDirection(float x, float y, float z);
    void setDirection(const D3DVECTOR &direction);
    void getDirection(float &x, float &y, float &z) const;
    D3DVECTOR getDirection() const;

    // Diffuse color.
    void setDiffuse(const D3DCOLORVALUE &color);
    void setDiffuse(float r, float g, float b, float a);
    D3DCOLORVALUE getDiffuse() const;
    void getDiffuse(float &r, float &g, float &b, float &a) const;

    // Specular color.
    void setSpecular(const D3DCOLORVALUE &color);
    void setSpecular(float r, float g, float b, float a);
    D3DCOLORVALUE getSpecular() const;
    void getSpecular(float &r, float &g, float &b, float &a) const;

    // Ambient color.
    void setAmbient(const D3DCOLORVALUE &color);
    void setAmbient(float r, float g, float b, float a);
    D3DCOLORVALUE getAmbient() const;
    void getAmbient(float &r, float &g, float &b, float &a) const;

    // Range.
    void setRange(float range);
    float getRange() const;

    // Falloff.
    void setFalloff(float falloff);
    float getFalloff() const;

    // Attemuation.
    void setAttenuation(float constant, float linear, float quadratic);
    void getAttenuation(float &constant, float &linear, float &quadratic) const;

    // Theta. 
    void setTheta(float angle);
    float getTheta() const;

    // Phi.
    void setPhi(float angle);
    float getPhi() const;

    // Light settings.
    void setLight(int index, LPDIRECT3DDEVICE9 pDevice);
private:
    // The light.
    D3DLIGHT9 m_Light;
};


#endif